<?php
// check if the fbid is the user himsel
echo '<div style="padding:20px">';
if(isset($_GET['fbid']) && $_GET['fbid']!=$user)
		{
			// for maintaining the nomencalture	
			if($user<$fbid)	
				$type = "pms_".$user."_".$fbid;
			else
		 		$type = "pms_".$fbid."_".$user;
			?>
			<!--<div style="background:#fee;width:250px;float:left;margin-right:10px;padding:5px;border-radius:5px;border:1px solid #ddd"><?php fetch_user_details($user); ?></div>-->
			<div ><?php fetch_user_details($fbid,"chat"); ?></div>
			<div class="clear"></div>
			<br>
			<hr><br>
			<div id="stream_<?php echo $type; ?>" class="stream">
				<img src="images/22.gif" />
			</div>
			<br>	 
			<input type="hidden" id="curr_type_stat" value="static"/>
			<input type="hidden" id="curr_type_stat_u" value="static"/>
			<div>&nbsp;<span id="type_stat_wrapper"></span></div><br>
			<?php
			$reduced_postbox = "true";
			include('php/modules/post_box.php'); 		
			echo '<script type="text/javascript">
			$(function() {
			init_pms('.$user.', "'.$type.'");
			init_inbox('.$user.','.$fbid.');
			change_type_stat("'.$type.'", '.$user.'); 
			});
			</script>';
		}	

else
	{		$user_unread1 = user_unread($user."_detail");
		if($user_unread1!="")
			echo $user_unread1.'<br><br>';
		echo '<span class="cfont2" style="font-size:25pt">Friends</span><br>';
		// displaying his friends
		$user_friends = $_SESSION['friends'];
		$query = "SELECT * FROM site_user_meta WHERE ";
		$frns_len = sizeof($user_friends['data']);
		for($i=0;$i<$frns_len-1;$i++)
			$query=$query." `fbid`= '".$user_friends["data"][$i]["id"]."' OR ";		
		$query=$query." `fbid`= '".$user_friends["data"][$frns_len-1]["id"]."'";
		$result = mysql_query($query);
		if(mysql_numrows($result) != 0) {
			disp_user($result, "gen", $user);
		}		echo '<div id="stream_'.$type.'" class="stream"></div>';
		echo '<script type="text/javascript">
			$(function() {			init_inbox('.$user.',"'.$fbid.'");
			});
			</script>';			
		
	}
echo '</div>';
?>
